using UnityEngine;

namespace Voodoo.Sauce.Internal.Ads
{
	public class BannerBackground : MonoBehaviour
	{
		private RectTransform _rect;

		private void Awake()
		{
			Object.DontDestroyOnLoad((!(base.transform.parent != null)) ? base.gameObject : base.transform.parent.gameObject);
		}

		private void Start()
		{
			_rect = GetComponent<RectTransform>();
			BannerAd.OnBannerShowing += Show;
			BannerAd.OnBannerHiding += Hide;
			Hide();
		}

		private void OnDestroy()
		{
			BannerAd.OnBannerShowing -= Show;
			BannerAd.OnBannerHiding -= Hide;
		}

		private void Hide()
		{
			base.gameObject.SetActive(value: false);
		}

		private void Show()
		{
			base.gameObject.SetActive(value: true);
		}
	}
}
